﻿using GrainManage.Entities.Weather;
using GrainManage.Server.Business;
using System.Web.Mvc;

namespace GrainManage.Server.Controllers
{
    public class WeatherController : BaseController
    {
        private readonly WeatherBusiness business = new WeatherBusiness();

        //************************************************POST************************************************
        [HttpPost]
        public ActionResult GetYahooWeather(InputGetYahooWeather input)
        {
            var result = business.GetYahooWeather(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetChinaRootWeather(InputGetChinaRootWeather input)
        {
            var result = business.GetChinaRootWeather(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetChinaCityWeather(InputGetChinaCityWeather input)
        {
            var result = business.GetChinaCityWeather(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetChinaCurrentWeather(InputGetChinaCurrentWeather input)
        {
            var result = business.GetChinaCurrentWeather(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetChinaNext7DayWeather(InputGetChinaNext7DayWeather input)
        {
            var result = business.GetChinaNext7DayWeather(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetImageUrl(InputGetImageUrl input)
        {
            var result = business.GetImageUrl(input);
            return NewtonsoftJson(result);
        }

        [HttpPost]
        public ActionResult GetImageFile(InputGetImageFile input)
        {
            var result = business.GetImageFile(input);
            return NewtonsoftJson(result);
        }
    }
}
